<template>
  <div class="app" id="app">
    <div class="tab">
      <el-menu class="el-menu-vertical-demo" @open="handleOpen" @close="handleClose"
        :collapse="isCollapse" background-color="#001529" text-color="#fff" active-text-color="#a6adb4" router>
        <el-menu-item index="/home">
          <i class="el-icon-s-home"></i>
          <span slot="title">首页</span>
        </el-menu-item>
        <el-submenu index="/system">
          <template slot="title">
            <i class="el-icon-setting"></i>
            <span slot="title">系统管理</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/system/admin">用户管理</el-menu-item>
            <el-menu-item index="/system/role">角色管理</el-menu-item>
            <el-menu-item index="/system/permissions">权限管理</el-menu-item>
            <el-menu-item index="/system/order">菜单管理</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="/list">
          <template slot="title">
            <i class="el-icon-s-operation"></i>
            <span slot="title">列表页</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/list/select">查询表格</el-menu-item>
            <el-menu-item index="/list/standard">标准列表</el-menu-item>
          </el-menu-item-group>
        </el-submenu>
        <el-submenu index="/from">
          <template slot="title">
            <i class="el-icon-edit-outline"></i>
            <span slot="title">表单页</span>
          </template>
          <el-menu-item-group>
            <el-menu-item index="/form/basis">基础表单</el-menu-item>
            <el-menu-item index="/form/stepByStep">分步表单</el-menu-item>
            <el-menu-item index="/form/senior">高级表单</el-menu-item>
          </el-menu-item-group>
        </el-submenu>

      </el-menu>
    </div>
    <div class="main">
      <div class="top">
        <div class="companding h" @click="companding">
          <i :class="icon"></i>
          <!-- <i class="el-icon-s-unfold"></i> -->
        </div>
        <div class="full-screen h">
          <i class="el-icon-full-screen"></i>
        </div>
        <div class="admin h">
          <i class="el-icon-user">admin</i>
        </div>
      </div>
      <div class="bottom">
        <router-view></router-view>
      </div>
    </div>

  </div>
</template>

<script>
export default {
  data() {
    return {
      //菜单伸缩
      isCollapse: false,
      icon:'el-icon-s-fold'
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    //菜单伸缩
    companding(){
      this.isCollapse=!this.isCollapse
      if(this.isCollapse){
        this.icon='el-icon-s-unfold'
      }else{
        this.icon='el-icon-s-fold'
      }
      
    }
  }
}
</script>

<style lang="less" scoped>
.app {
  width: 100%;
  min-width: 1200px;
  display: flex;

  .tab {
    .el-menu-vertical-demo:not(.el-menu--collapse) {
      width: 260px;
      height: 100vh;
    }
    .el-menu--collapse{
      height: 100vh;
    }
  }

  .main {
    width: 100%;
    min-height: 400px;
    background-color: #f0f2f5;

    .top {
      height: 65px;
      width: 100%;
      background-color: #ffffff;
      display: flex;
      justify-content: flex-end;

      .companding {
        width: 65px;
        height: 65px;
        margin-right: auto;
        font-size: 22px;
        line-height: 65px;
        text-align: center;
      }

      .full-screen {
        width: 76px;
        height: 65px;
        font-size: 20px;
        line-height: 65px;
        text-align: center;

      }

      .admin {
        width: 102px;
        height: 65px;
        font-size: 20px;
        line-height: 65px;
        text-align: center;
        i{
          font-size: 18px;
        }
      }
      .h:hover{
        background-color: #d1e3fa;
        cursor:default;
      }
    }
    .bottom{
      padding: 16px;
      width: 100%;
      box-sizing: border-box;
    }
  }

}
</style>